package com.newford.test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

public class ConnectAccessDriver {

	public static void main(String[] args) {
		String strurl="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\Documents and Settings\\Administrator\\rzy.mdb";
		Properties prop = new Properties();  
		prop.put("charSet", "gb2312");
		prop.put("user", "user");
		prop.put("password", "rzy");
		try {
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			Connection conn = DriverManager.getConnection(strurl,prop);// 创建连接对象
			Statement stmt1=conn.createStatement();//创建数据处理对象  
//			String sql = "delete from t_news";
			String sql = "insert into person values('121','中文')";
//			String sql = "create table t_news("+
//			"newsid char(32) primary key,"+
//			"title varchar(200) not null,"+
//			"content Text,"+
//			"userid char(32),"+
//			"commitdate DateTime,"+
//			"updatedate DateTime,"+
//			"href Text,"+
//			"delflag char(2),"+
//			"readtime int"+
//			");";
			stmt1.execute(sql);
			stmt1.close();
			conn.close();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
	}

}
